package cn.edu.scau.cmi.yangzemin.singleton;

import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;

public class UIController {

    @FXML
    private Label output;

    @FXML
    private Button createButton;

    @FXML
    private TextField text; 
    
    public void init()
    { 
    	createButton.setOnAction(this::createChairman);
    }
     
    void createChairman(ActionEvent event) {
    	Chairman chairman = Chairman.getInstance(text.getText());
    	System.out.println("hello");
    	if (!output.getText().equals("")) { 
    		output.setText(output.getText() + "\n");
    	}
    	output.setText(output.getText() + chairman.getName()  + chairman);
    }

}
